<template>
  <a-carousel :after-change="onChange" autoplay>

    <div v-for="(item,index) in carouselList" :key="index" style="position: relative">
      <img class="carousel-img" :src="item.url" :alt="item.name" >
      <div class="carousel-description">item.description</div>
    </div>
  </a-carousel>
</template>

<script>
export default {
  name: 'carousel'
}
</script>

<script setup>
import {LeftCircleOutlined,RightCircleOutlined } from "@ant-design/icons-vue";
const carouselList = [{
  url: 'https://www.spic-coalcg.com/resource/site_1//spic/images/banner.png',
  name: '煤炭',
  description: '这是一个描述1'
},{
  url: 'https://www.spic-coalcg.com/resource/site_1//spic/images/banner.png',
  name: '煤炭',
  description: '这是一个描述2'
},{
  url: 'https://www.spic-coalcg.com/resource/site_1//spic/images/banner.png',
  name: '煤炭',
  description: '这是一个描述3'
},]
const onChange = (current) => {
  // console.log(current);
};
</script>


<style scoped>

.carousel-description{
  position: absolute;
  bottom: 0;
  left: 0;
  opacity: 0.1;
  background-color: #0e161f;
  color: white;
  width: 100%;
  font-weight: bold;
  text-align: left;
  height: 40px;
}

.carousel-img{
  width: 100%;
  height: 360px;
  object-fit: cover;
}

.ant-carousel :deep(.slick-slide) {
  text-align: center;
  height: 360px;
  line-height: 160px;
  background: #364d79;
  overflow: hidden;
}

.ant-carousel :deep(.slick-arrow.custom-slick-arrow) {
  width: 25px;
  height: 25px;
  font-size: 25px;
  color: #fff;
  background-color: rgba(31, 45, 61, 0.11);
  opacity: 0.3;
  z-index: 2;
}
.ant-carousel :deep(.custom-slick-arrow:before) {
  display: none;
}
.ant-carousel :deep(.custom-slick-arrow:hover) {
  opacity: 0.5;
}

.ant-carousel :deep(.slick-slide h3) {
  color: #fff;
}
</style>
